<div class="{% if index|divisibleby:"2" %}tw:border-neutral/50{% else %}{% endif %} tw:border-2 tw:rounded-lg tw:py-2 tw:px-4 {% if not forloop.first %}tw:mt-2{% endif %}">
    <details class="flex flex-col" {% if formset|length < 3 %}open{% endif %}>
        <summary>
            <span class="tw:text-lg tw:font-semibold">{% trans title %}</span> 
        </summary>

        <div id="{{ form_type }}-formset" class="tw:w-full tw:flex tw:flex-col">
            {{ formset.management_form }}
            {% for form in formset %}
                {% include "./form.html" with prefix=form_type form=form index=forloop.counter0 %}
            {% endfor %}
        </div>
        
        <div class="tw:flex tw:flex-row-reverse">
            {% if in_create or in_edit %}
                <button type="tw:button" class="tw:btn"
                    hx-get="{% url 'project:human_genetic_resource/add_form' project_pk=project.id form_type=form_type %}"
                    hx-target="#{{ form_type }}-formset"
                    hx-swap="beforeend">
                    {% trans '添加新行' %}
                </button>
            {% endif %}
        </div>
    </details>
</div>
